﻿using System.Linq.Expressions;

namespace AIO.IService.Base
{
    /// <summary>
    /// 基础仓库接口
    /// </summary>
    public interface IBaseRepository<T>
    {
        /// <summary>
        /// 获取所有
        /// </summary>
        /// <returns></returns>
        public Task<List<T>> GetAllNoByAsync();
        /// <summary>
        /// 获取所有
        /// </summary>
        /// <returns></returns>
        public IQueryable<T> GetAllNoBy();

        /// <summary>
        /// 获取所有(合法数据)
        /// </summary>
        /// <returns></returns>
        public Task<List<T>> GetAllAsync(Expression<Func<T, bool>> expression);
        /// <summary>
        /// 获取所有(合法数据)
        /// </summary>
        /// <returns></returns>
        public IQueryable<T> GetAll(Expression<Func<T, bool>> expression);

        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        public void Create(T entity);
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        public void Update(T entity);

        /// <summary>
        /// 根据ID删除
        /// </summary>
        /// <param name="id">数据ID</param>
        /// <returns></returns>
        public void Delete(T entity);


    }
}
